package leetcode.code1773;

import java.util.List;

public class Solution {
	public int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {
		if (ruleKey.equals("color")) {
			return (int) items.stream().filter(item -> item.get(1).equals(ruleValue)).count();
		} else if (ruleKey.equals("type")) {
			return (int) items.stream().filter(item -> item.get(0).equals(ruleValue)).count();
		} else {
			return (int) items.stream().filter(item -> item.get(2).equals(ruleValue)).count();
		}
	}
}
